<?php
CHtml::$errorMessageCss = 'error';
echo CHtml::beginForm('', 'post', array(
    'id'      => 'slideshow-form',
    'class'   => 'form',
    'enctype' => 'multipart/form-data',
));
?>

<table width="100%">
    <colgroup>
        <col width="400">
        <col>
    </colgroup>
    <tbody>
        <tr>
            <td>
                <div class="slideshowUploadBox">
                    <?php
                    echo CHtml::activeHiddenField($model, 'id');
                    echo CHtml::activeHiddenField($model, 'file');
                    echo CHtml::activeHiddenField($model, 'thumb');
                    ?>
                    <div id="pickfiles" class="slideshowPickfiles">
                        <?php
                        $fileVal = $model->getAttribute('thumb');
                        if (! empty($fileVal)) {
                            echo CHtml::image(Yii::app()->baseUrl
                                . Yii::app()->params['tempo_url']
                                . $fileVal
                            );
                        }
                        ?>
                    </div>
                </div>
                <div id="slideshowUploadFileMsg" class="slideshowUploadFileMsg error"><?php
                    echo $model->getError('thumb');
                ?></div>
            </td>
            
            <td style="vertical-align: top;">
                <fieldset>
                    <ul>
                        <li>
                            <?php
                                $attr = 'title';
                                echo CHtml::activeLabel($model, $attr, array(
                                    'required' => true,
                                    'class' => 'desc',
                                ));
                            ?>
                            <div><?php
                                echo CHtml::activeTextField($model, $attr, array(
                                    'class' => 'text full'
                                ));
                                echo CHtml::error($model, $attr);
                            ?></div>
                        </li>

                        <li>
                            <?php
                                $attr = 'link';
                                echo CHtml::activeLabel($model, $attr, array(
                                    'class'    => 'desc',
                                    'style'    => 'display: inline;'
                                ));
                                echo '&nbsp;&nbsp;';
                                echo CHtml::link('(?)', 'javascript:void(0)', array(
                                    'id'    => 'assign-link',
                                    'class' => 'link_strong',
                                    'title' => Yii::t('DadminModule.app', 'link_helper'),
                                    'style' => 'display: inline;'
                                ));
                            ?>
                            <div><?php
                                echo CHtml::activeTextField($model, $attr, array(
                                    'class' => 'text full'
                                ));
                                echo CHtml::error($model, $attr);
                            ?></div>
                        </li>

                        <li>
                            <?php
                            echo CHtml::label(
                                $model->getAttributeLabel('status'),
                                'status',
                                array('class' => 'desc'));
                            ?>
                            <div>
                                <table>
                                    <tr>
                                        <td><?php
                                        $attr = 'activated_flag';
                                        echo CHtml::activeCheckBox($model, $attr, array(
                                            'class' => 'checkbox',
                                        ));
                                        echo CHtml::label($model->getAttributeLabel($attr),
                                            'DSlideshow_activated_flag',
                                            array('class' => 'choice', 'style'=>'margin-right:25px;'));
                                        ?></td>

                                        <td><?php
                                        $attr = 'preview_flag';
                                        echo CHtml::activeHiddenField($model, $attr);
                                        echo '&nbsp;';
//                                        echo CHtml::activeCheckBox($model, $attr, array(
//                                            'class' => 'checkbox',
//                                        ));
//                                        echo CHtml::label($model->getAttributeLabel($attr),
//                                            'DSlideshow_preview_flag',
//                                            array('class' => 'choice'));
                                        ?></td>
                                    </tr>
                                </table>
                            </div>
                        </li>
                        
                        <!-- buttons -->
                        <li style="text-align: center;">
                        <?php
                        $label = Yii::t('DadminModule.app', 'save_u');
                        echo CHtml::submitButton($label, array(
                            'name'  => 'submit',
                            'class' => 'ui-state-default ui-corner-all ui-button'
                        ));
                        
                        $label = Yii::t('DadminModule.app', 'reset_u');
                        echo CHtml::button($label, array(
                            'type'  => 'button',
                            'id'    => 'btn-reset',
                            'class' => 'ui-state-default ui-corner-all ui-button',
                            'style' => 'margin:0 10px;',
                            'ref' => ($model->getScenario() == 'insert') ? $this->createUrl('create') 
                                : $this->createUrl('update', array('id'=>$model->id)),
                        ));
                        
                        $label = Yii::t('DadminModule.app', 'cancel_u');
                        echo CHtml::button($label, array(
                            'id'    => 'btn-cancel',
                            'class' => 'ui-state-default ui-corner-all ui-button btn-cancel'
                        ));
                        ?>
                        </li>
                        <!-- //buttons -->
                    </ul>
                </fieldset>
            </td>
        </tr>
        <tr>
        </tr>
    </tbody>
</table>
<?php echo CHtml::endForm(); ?>

<!-- Dialog -->
<div id="dialogLinks" title="Quick links" style="display:none;"></div>
<!-- End of Dialog -->